package com.see.services.impl;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.google.gson.Gson;
import com.see.domain.model.GoogleObject;
import com.see.domain.model.StockDetail;
import com.see.network.api.HtmlReader;
import com.see.services.api.StockDetailParser;

public class StockDetailParserImpl implements StockDetailParser {

	private HtmlReader htmlReader;
	public StockDetailParserImpl(HtmlReader htmlReader) {
		 this.htmlReader = htmlReader;
	 }
	 
	@Override
	public Collection<StockDetail> parse(String googleUrlString) {

		String result = htmlReader.readHtml(googleUrlString, false);
		result = result.replaceAll("//", "");
		Gson gson = new Gson();
		GoogleObject[] googleObjects = gson.fromJson(result,GoogleObject[].class );
		List<StockDetail> detailList = new ArrayList<StockDetail>();
	
		return detailList;
	}

}
